package com.blazer.e;

public class test05 {
    //可变参数本质是一个数组
    //参数位置不能连续写多个可变参数，而且当可变参数和其他参数在一起时需要将可变参数放到参数列表最后
    public static void main(String[] args) {
        sum(0,1,2,3,4,5);
        concat(0,"-","陈伟霆","朱一龙","王凯");


    }
    public static void sum(int i,int...arr){
        int sum=0;
        for (int ii=i;ii<arr.length;ii++){
            sum+=arr[ii];
        }
        System.out.println(sum);
    }
    public static void concat(int i,String n,String...arr){
        String name="";
        for (int j=i;j<arr.length;j++){
           if(j==arr.length-1){
               name+=arr[j];

           }else{
               name+=arr[j]+n;
           }

             }
        System.out.println(name);
    }
}
